package com.gopay.common.domain.cbrmb.customs;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;

@Entity
@Table(name = "CB_RMB_CUSTOMS_PAYMENT")
public class CbRmbCustomsPayment implements Serializable {

	/**
	 * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
	 */
	private static final long serialVersionUID = 1L;

    private Integer sq;

	/**
	 * 企业系统生成36位唯一序号（英文字母大写）。
	 */
	private String guid;

	/**
	 * 企业报送类型。1-新增 2-变更 3-删除。默认为1。。
	 */
	private String appType;

	/**
	 * 企业报送时间。格式:YYYYMMDDhhmmss。
	 */
	private String appTime;

	/**
	 * 业务状态:1-暂存,2-申报,默认为2。
	 */
	private String appStatus;

	/**
	 * 支付企业的海关注册登记编号。
	 */
	private String payCode;

	/**
	 * 支付企业在海关注册登记的名称。
	 */
	private String payName;

	/**
	 * 支付企业唯一的支付流水号。
	 */
	private String payTransactionId;

	/**
	 * 交易平台的订单编号，同一交易平台的订单编号应唯一。订单编号长度不能超过60位。
	 */
	private String orderNo;

	/**
	 * 电商平台的海关注册登记编号；电商平台未在海关注册登记，由电商企业发送订单的，以中国电子口岸发布的电商平台标识编号为准。
	 */
	private String ebpCode;

	/**
	 * 电商平台的海关注册登记编号；电商平台未在海关注册登记，由电商企业发送订单的，以中国电子口岸发布的电商平台标识编号为准。
	 */
	private String ebpName;

	/**
	 * 1-身份证,2-其它。限定为身份证，填写“1”。
	 */
	private String payerIdType;

	/**
	 * 支付人的身份证件号码。
	 */
	private String payerIdNumber;

	/**
	 * 支付人的真实姓名。
	 */
	private String payerName;

	/**
	 * 支付人的电话号码。
	 */
	private String telephone;

	/**
	 * 支付金额。
	 */
	private BigDecimal amountPaid;

	/**
	 * 限定为人民币，填写“142”。
	 */
	private String currency;

	/**
	 * 支付时间，格式:YYYYMMDDhhmmss。
	 */
	private String payTime;

	/**
	 * 备注
	 */
	private String note;

	/**
	 * 操作结果（2电子口岸申报中/3发送海关成功/4发送海关失败/100海关退单/120海关入库）,若小于0数字表示处理异常回执
	 */
	private String returnStatus;

	/**
	 * 操作时间(格式:YYYYMMDDhhmmssSSS)
	 */
	private String returnTime;

	/**
	 * 备注（如:退单原因）
	 */
	private String returnInfo;

	/**
	 * 最后更新时间
	 */
	private Date createTime;

	/**
	 * 最后更新时间
	 */
	private Date lastUpdateTime;

	/**
	 * 版本
	 */
	private int version;

	/**
	 * 状态：00：待报关 , 01：报关进行中 , 02：报关完成 , 03: 已删除
	 */
	private String state;

	/**
	 * 原订单ID (流水号)
	 */
	private Integer originalOrderId;
	
	/**
	 * 是否锁定变为已删除
	 */
	private String lockDelete;
	
	/**
	 * 报关通道
	 */
	private String postCustoms;

	@Id
	@SequenceGenerator(name = "CB_RMB_CUSTOMS_PAYMENT_SQ", sequenceName = "CB_RMB_CUSTOMS_PAYMENT_SQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CB_RMB_CUSTOMS_PAYMENT_SQ")
	@Column(name = "CB_RMB_CUSTOMS_PAYMENT_SQ", unique = true, nullable = false)
	public Integer getSq() {
		return sq;
	}

	public void setSq(Integer sq) {
		this.sq = sq;
	}

	@Column(name = "GU_ID")
	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	@Column(name = "APP_TYPE")
	public String getAppType() {
		return appType;
	}

	public void setAppType(String appType) {
		this.appType = appType;
	}

	@Column(name = "APP_TIME")
	public String getAppTime() {
		return appTime;
	}

	public void setAppTime(String appTime) {
		this.appTime = appTime;
	}

	@Column(name = "APP_STATUS")
	public String getAppStatus() {
		return appStatus;
	}

	public void setAppStatus(String appStatus) {
		this.appStatus = appStatus;
	}

	@Column(name = "PAY_CODE")
	public String getPayCode() {
		return payCode;
	}

	public void setPayCode(String payCode) {
		this.payCode = payCode;
	}

	@Column(name = "PAY_NAME")
	public String getPayName() {
		return payName;
	}

	public void setPayName(String payName) {
		this.payName = payName;
	}

	@Column(name = "PAY_TRANSACTION_ID")
	public String getPayTransactionId() {
		return payTransactionId;
	}

	public void setPayTransactionId(String payTransactionId) {
		this.payTransactionId = payTransactionId;
	}

	@Column(name = "ORDER_NO")
	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	@Column(name = "EBP_CODE")
	public String getEbpCode() {
		return ebpCode;
	}

	public void setEbpCode(String ebpCode) {
		this.ebpCode = ebpCode;
	}

	@Column(name = "EBP_NAME")
	public String getEbpName() {
		return ebpName;
	}

	public void setEbpName(String ebpName) {
		this.ebpName = ebpName;
	}

	@Column(name = "PAYER_ID_TYPE")
	public String getPayerIdType() {
		return payerIdType;
	}

	public void setPayerIdType(String payerIdType) {
		this.payerIdType = payerIdType;
	}
	
	@Column(name = "PAYER_ID_NUMBER")
	public String getPayerIdNumber() {
		 this.payerIdNumber = SensitiveInfoUtils.autoReencrypt(this.payerIdNumber);
	     return SensitiveInfoUtils.smartDecryptWithCheck(this.payerIdNumber);
	}

	public void setPayerIdNumber(String payerIdNumber) {
		this.payerIdNumber = SensitiveInfoUtils.smartEncryptWithCheck(payerIdNumber);
	}

	@Column(name = "PAYER_NAME")
	public String getPayerName() {
		return payerName;
	}

	public void setPayerName(String payerName) {
		this.payerName = payerName;
	}

	@Column(name = "TELEPHONE")
	public String getTelephone() {
		 this.telephone = SensitiveInfoUtils.autoReencrypt(this.telephone);
	     return SensitiveInfoUtils.smartDecryptWithCheck(this.telephone);
	}

	public void setTelephone(String telephone) {
		this.telephone = SensitiveInfoUtils.smartEncryptWithCheck(telephone);
	}

	@Column(name = "AMOUNT_PAID")
	public BigDecimal getAmountPaid() {
		return amountPaid;
	}

	public void setAmountPaid(BigDecimal amountPaid) {
		this.amountPaid = amountPaid;
	}

	@Column(name = "CURRENCY")
	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	@Column(name = "PAY_TIME")
	public String getPayTime() {
		return payTime;
	}

	public void setPayTime(String payTime) {
		this.payTime = payTime;
	}

	@Column(name = "NOTE")
	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	@Column(name = "RETURN_STATUS")
	public String getReturnStatus() {
		return returnStatus;
	}

	public void setReturnStatus(String returnStatus) {
		this.returnStatus = returnStatus;
	}

	@Column(name = "RETURN_TIME")
	public String getReturnTime() {
		return returnTime;
	}

	public void setReturnTime(String returnTime) {
		this.returnTime = returnTime;
	}

	@Column(name = "RETURN_INFO")
	public String getReturnInfo() {
		return returnInfo;
	}

	public void setReturnInfo(String returnInfo) {
		this.returnInfo = returnInfo;
	}

	@Column(name = "CREATE_TIME")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "LAST_UPDATE_TIME")
	public Date getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(Date lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}

	@Version
	@Column(name = "VERSION", nullable = false, precision = 22, scale = 0)
	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	@Column(name = "STATE")
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "ORIGINAL_ORDER_ID")
	public Integer getOriginalOrderId() {
		return originalOrderId;
	}

	public void setOriginalOrderId(Integer originalOrderId) {
		this.originalOrderId = originalOrderId;
	}
	
	@Column(name = "LOCK_DELETE")
	public String getLockDelete() {
		return lockDelete;
	}

	public void setLockDelete(String lockDelete) {
		this.lockDelete = lockDelete;
	}
	
	@Column(name = "POST_CUSTOMS")
	public String getPostCustoms() {
		return postCustoms;
	}

	public void setPostCustoms(String postCustoms) {
		this.postCustoms = postCustoms;
	}

	@Override
	public String toString() {
		return "CbRmbCustomsPayment [sq=" + sq + ", guid=" + guid + ", appType=" + appType + ", appTime=" + appTime
				+ ", appStatus=" + appStatus + ", payCode=" + payCode + ", payName=" + payName + ", payTransactionId="
				+ payTransactionId + ", orderNo=" + orderNo + ", ebpCode=" + ebpCode + ", ebpName=" + ebpName
				+ ", payerIdType=" + payerIdType + ", payerName=" + payerName + ", amountPaid=" + amountPaid
				+ ", currency=" + currency + ", payTime=" + payTime + ", note=" + note + ", returnStatus="
				+ returnStatus + ", returnTime=" + returnTime + ", returnInfo=" + returnInfo + ", createTime="
				+ createTime + ", lastUpdateTime=" + lastUpdateTime + ", version=" + version + ", state=" + state
				+ ", originalOrderId=" + originalOrderId + ", lockDelete=" + lockDelete + ", postCustoms=" + postCustoms
				+ "]";
	}

	
}
